package com.example.demo.service.Impl;

import com.example.demo.entity.Message;
import com.example.demo.mapper.user.MessageMapper;
import com.example.demo.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("messageService")
public class MessageServiceImpl implements MessageService {
    @Autowired
    private MessageMapper messageMapper;

    @Override
    public List<Message> getMessageList(Message message) {
        return messageMapper.queryMessageList(message);
    }

    @Override
    public Message queryMessage(Message message) {
        return messageMapper.selectByPrimaryKey(message.getId());
    }

    @Override
    public void addMessage(Message message) throws Exception {
        messageMapper.insert(message);
    }

    @Override
    public void updateMessage(Message message) throws Exception {
        messageMapper.updateByPrimaryKey(message);
    }
}
